using System;
using System.Diagnostics;
using System.Collections.Generic;
using org.tmatesoft.svn.core;
using org.tmatesoft.svn.core.wc;

namespace Subsync.Core.Subversion
{
	/// <summary>
	/// Author: Zhang Andy
	/// </summary>
    class SVNCleanup : CommandBase
    {
        // Initialise variables with default settings.
        private java.io.File filePath;

        // Constructor
        public SVNCleanup(string path)
        {
            Debug.WriteLine("SVNLock Constructor");
            this.filePath = new java.io.File(path);
        }

        public override void Execute()
        {
            Debug.WriteLine("SVNLock Execution");

            //library setup
            Tools.SetupLibrary();

            //load up the clients
            SVNClientManager cm = SVNClientManager.newInstance();
            SVNWCClient wc = cm.getWCClient();

            try
            {
                wc.doCleanup(this.filePath);
            }
            catch (SVNException e)
            {
                throw new SVNExecuteException(e.getMessage());
            }
        }
    }
}
